package jtt808

import (
	"sync"
	"time"
)

const (
	DeviceReg        = 0x0100 // 终端注册
	DeviceAuth       = 0x0102 // 终端对鉴权码进行鉴权
	Heartbeat        = 0x0002 // 终端心跳
	DeviceAnswerId   = 0x0001 //终端通用应答ID
	PlatformAnswerId = 0x8001 //平台通用应答ID
	LocationReport   = 0x0200 //位置信息汇报
)

type Devices sync.Map

// 808消息接口
type Jtt808Packet interface {
	GetJtt808Id() uint16
	GetData() []byte
}

// 发包 应答处理，例如有些包未收到平台应答就续传
type PacketRelated struct {
	Data  []byte    //完整原始一包
	MsgId int       //消息ID
	Ti    time.Time //时间
}

type PacketCache sync.Map //key:序号_消息ID_时间戳  value:PacketRelated

var PacketSeq uint32
